package com.future.bantang.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;

import com.lidroid.xutils.ViewUtils;

/**
 * Created by Administrator on 16-1-11.
 */
public class BaseFragment extends Fragment {

    protected FragmentManager mFragmentManager;

    public static BaseFragment getInstance(Class<? extends BaseFragment> cls){
        if (cls!=null){
            try {
                return cls.newInstance();
            } catch (java.lang.InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        ViewUtils.inject(this, view);
        mFragmentManager=getChildFragmentManager();

        initView(view);
        loadDatas();

    }

    /**
     * 初始化view方法
     * @param view
     */
    protected void initView(View view) {

    }

    /**
     * 加载数据的方法
     */
    protected void loadDatas() {

    }


    /**
     * 切换显示fragment的方法
     * @param containorRes
     * @param cls
     */

}
